% This code's purpose is to load global parameters and enables simple testing of the system

% Global parameters description:

% Debug and general parameters - 
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% debug_flag - a flag that controlled the output of image_labels function - 
%           0 - ouput contains only the label's map. 
%           1 - ouput contains - label's map, segments' map and table, vote and confidence cells.
%           2 - ouput contains all the results of 1 and also result struct from get_struct of each hypothese.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Model training and image labeling parameters - 
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% norm_flag_seg - how to normalize the segment's features. options are - 
%          'true'   - normalizing all data to [0,1] range. 
%          'false' - no normalization.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% norm_flag_reg - how to normalize the region's features. options are - 
%          'true'   - normalizing all data to [0,1] range. 
%          'false' - no normalization.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% hypo_amount- number of hypothesises for each value in reg_per_hypo.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% reg_per_hypo - array of values indicates the number of regions in  a hypothesis.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% hypo_option  -
%           'distance' - dist calculation for hypothesis.
%           'kmeans' - kmeans calculation for hypothesis. 
%           both are using connected components scheme.
%           'segmentation' - calculate hypothesis using coarse segmentation scheme.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% bw_factor -  the BWLABEL factor to be used during region's map creation. options - 4 or 8 (recommended).
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% med_filter - flag to set if to run a median filter (medfilt2) before BWLABEL. options - 'true' or 'false'.
% currently not supported.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% image_resize_flag - a flag to make pre proccessing for the image by low pass filter and resizing.
%           'true' - make pre proccessing with gaussian low pass filter and resizing by image_resize_factor.
%           'false' - don't make pre proccessing.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% image_resize_factor - a factor for resizing of the image, if image_resize_flag is set to true.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Classifiers parameters - 
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% class_func - the classifier function -
%           'FLD' - Fisher Linear Discriminat.
%           'KNN'   - K-nearest neighbours classifier.
%           'RealAdaBoost' - AdaBoost classifier - Real AdaBoost algorithm.
%           'ModestAdaBoost' - AdaBoost classifier - Modest AdaBoost algorithm.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% if_cross_validation - a flag for if to do a cross validation with FLD classifier (true or false).
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% cross_validation_precent - the test data precent for each step in the cross validation process.
% this precent will be multiply with the current iteration.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% cross_validation_iteration - the amount test data's iterations in the cross validation process.
% in each iteration the size of the test data will be iterationXprecentXsize of the entire data.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% cross_validation_NIT - number of iteration for the same test data in the cross validation process.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% cross_validation_display - a statistics display flag for the cross validation process.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% class_kn -  the K neighbours on the KNN classifier.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% class_adaboost_Maxitr - amount of iterations for the AdaBoost classifier.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% class_adaboost_weak - the tree disterbution for the AdaBoost classifier.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Decision making parameters - 
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% voting_style - the way to vote the right label for each region or segment -
%           'polling' - by max vote from the hypothesis. in case of tie, set to be undefined.
%            'max_value' - label by the max value that the classifier gave from all sub-classes.
%            'sum_value' - label by the max sum values that the classifier gave.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% norm_prob - normalization of the probability matrix flag (true or false).
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% classifier_mix - a flag that set the labeling  an image by several classifiers or by a single one.
%          options are 'true' or 'false', while the single classifier is obtained from class_func. 
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Segmentation parameters - 
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% sigma - used to smooth the input image before segmenting it.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% K_th - value of the threshold function in segmentation process. larger value -> larger regions.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% k_step - value of the threshold increment inside the segmentation hypothesis creation.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% min_size -  minimum component size enforced by post-processing in segmentation process.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% min_step - value of the minimum component increment inside the segmentation hypothesis creation.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% declaration of all global parameters - each unit should declare also of the needed parameters
global model_p
global label_p
global segment_p

% parameters for the create_models_from_images function
model_p.norm_flag_seg='true';
model_p.norm_flag_reg='true';                         
model_p.hypo_amount=1;
model_p.reg_per_hypo=25;
model_p.hypo_option='distance';                            
model_p.bw_factor=8;
model_p.med_filter='false';
model_p.class_func='RealAdaBoost';               
model_p.if_cross_validation='true';                  
model_p.cross_validation_precent=0.02;
model_p.cross_validation_iteration=7;
model_p.cross_validation_NIT=50;
model_p.cross_validation_display=1;
model_p.class_kn=5;
model_p.class_adaboost_Maxitr=100;
model_p.class_adaboost_weak=3;

% some parameters are the same and some more parameters for the image_label function
label_p.debug_flag=2;
label_p.norm_flag_seg='true';
label_p.norm_flag_reg='true';
label_p.hypo_amount=3;
label_p.reg_per_hypo=[20,25,30];
label_p.hypo_option='distance';
label_p.bw_factor=8;
label_p.med_filter='true';
label_p.segment_voting_style='polling';          
label_p.norm_prob='false';                                              
label_p.image_resize_flag='false';
label_p.image_resize_factor=0.6;
label_p.classifier_mix='false';

% parameters of segmentation
segment_p.sigma=0.5;
segment_p.K_th=300;
segment_p.k_step=100;
segment_p.min_size=50;
segment_p.min_step=50;


